<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ include file="/pages/common/header.jsp"%>
</head>
<body>
	<div class="contentBody contentborder">
		<div class="tab-pane" id="tabPane">
			<div id="message"><%=message %></div>
			<div class="tab-page" id="tabPage1">
				<h1 class="tab">菜单链接配置</h1>
				<div class="contentborder tableForm">
					<jdf:form bean="entity" scope="request">
						<form action="<%=dynamicDomain%>/menuLink/save" method="post">
							<input type="hidden" name="id">
							<input type="hidden" name="menuId" value="${menuId}">
							<table class="inputTable">
							    <tr>
									<td nowrap class="label cancelBorderLeft">
										<label for="url">URL：</label>
									</td>
									<td class="content">
										<input type="text" name="url" />
									</td>
									<td nowrap class="label">
										<label for="remark">描述：</label>
									</td>
									<td class="content">
										<input type="text" name="remark" />
									</td>
								</tr>
								<tr>
									<td class="bottomLabel" nowrap colspan="4">
										<div class="right">
											<button type="submit">增加</button>
											<button type="button" onclick="toUrl('<%=dynamicDomain%>/menu/page')">返回</button>
										</div>
									</td>
								</tr>
							</table>
						</form>
					</jdf:form>
				</div>
			</div>
			<c:if test="${not empty menuLinks}">
			<div class="tab-page" id="tabPage2">
				<h1 class="tab">已配置链接</h1>
				<div class="contentborder tableForm">
					<table class="inputTable">
						<c:forEach var="item" items="${menuLinks}" varStatus="num">
						<c:choose>
							<c:when test="${!num.last}">
								<form action="<%=dynamicDomain%>/menuLink/save" method="post" id="form_${num.index}">
									<input type="hidden" name="id" value="${item.id}">
									<input type="hidden" name="menuId" value="${item.menuId}">
									<tr>
										<td nowrap class="label cancelBorderLeft">
											<label for="url">URL：</label>
										</td>
										<td class="content">
											<input type="text" name="url" value="${item.url}" />
										</td>
										<td nowrap class="label">
											<label for="remark">描述：</label>
										</td>
										<td class="content">
											<input type="text" name="remark" value="${item.remark}" />
										</td>
										<td class="label cancelBorderRight">
											<button type="submit">修改</button>
											<button type="submit" onclick="$('#form_${num.index}').attr('action','<%=dynamicDomain%>/menuLink/delete/${item.id}')">删除</button>
										</td>
									</tr>
								</form>
							</c:when>
							<c:otherwise>
								<form action="<%=dynamicDomain%>/menuLink/save" method="post" id="form_${num.index}">
									<input type="hidden" name="id" value="${item.id}">
									<input type="hidden" name="menuId" value="${item.menuId}">
									<tr>
										<td nowrap class="label cancelBorderLeft cancelBorderBottom">
											<label for="url">URL：</label>
										</td>
										<td class="content cancelBorderBottom">
											<input type="text" name="url" value="${item.url}" />
										</td>
										<td nowrap class="label cancelBorderBottom">
											<label for="remark">描述：</label>
										</td>
										<td class="content cancelBorderBottom">
											<input type="text" name="remark" value="${item.remark}" />
										</td>
										<td class="label cancelBorderBottom cancelBorderRight">
											<button type="submit">修改</button>
											<button type="submit" onclick="$('#form_${num.index}').attr('action','<%=dynamicDomain%>/menuLink/delete/${item.id}')">删除</button>
										</td>
									</tr>
								</form>
							</c:otherwise>
						</c:choose>
						</c:forEach>
					</table>
				</div>
			</div>
			</c:if>
		</div>
	</div>
	<jdf:tableLabelValidate domain="MenuLink"/>
</body>
</html>